package com.yunhai.recipe.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.model.entity.FmsSpecificationItemConfigQuery;
import com.yunhai.model.entity.fms.FmsSpecificationItemConfigEntity;
import com.yunhai.model.entity.fms.FmsSpecificationItemConfigVo;
import com.yunhai.recipe.service.FmsSpecificationItemConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.Api;
import java.util.List;

/**
 *  接口层
 *
 * @author mengze 该项目是知识星球：java突击队 的内部项目
 * @date 2025-05-22 10:02:36
 */
@Api(tags = "操作", description = "接口")
@RestController
@RequestMapping("/specificationItemConfig")
public class FmsSpecificationItemConfigController {

	@Autowired
	private FmsSpecificationItemConfigService fmsSpecificationItemConfigService;


	/**
	 * 获取 FmsSpecificationConfig 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getFmsSpecificationItemConfigPagination(PaginationVo paginationVo, FmsSpecificationItemConfigQuery fmsSpecificationItemConfigQuery ) throws Exception {
		IPage page = fmsSpecificationItemConfigService.getFmsSpecificationItemConfigPagination(paginationVo, fmsSpecificationItemConfigQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 FmsSpecificationConfig 所有数据
	 */
	@GetMapping("/all")
	public Ret getFmsSpecificationItemConfigAllList( FmsSpecificationItemConfigQuery fmsSpecificationItemConfigQuery ) throws Exception {
		List<FmsSpecificationItemConfigEntity> list = fmsSpecificationItemConfigService.getFmsSpecificationItemConfigAllList( fmsSpecificationItemConfigQuery );
		return Ret.ok(list);
	}



	/**
	 * 获取 FmsSpecificationConfig 详情
	 */
	@GetMapping("/{id}")
	public Ret getFmsSpecificationItemConfigDetail(@PathVariable Long id) throws Exception {

		FmsSpecificationItemConfigEntity fmsSpecificationItemConfigEntity = fmsSpecificationItemConfigService.getFmsSpecificationItemConfigDetail(id);
		return Ret.ok(fmsSpecificationItemConfigEntity);
	}


	/**
	 * 新增 FmsSpecificationConfig
	 * */
	@PostMapping("")
	public Ret addFmsSpecificationItemConfig(@RequestBody FmsSpecificationItemConfigVo fmsSpecificationItemConfigVo) throws Exception {

		fmsSpecificationItemConfigService.addFmsSpecificationItemConfig(fmsSpecificationItemConfigVo);
		return Ret.ok();
	}


	/**
	 * 更新 FmsSpecificationConfig
	 * */
	@PutMapping("")
	public Ret updateFmsSpecificationConfig(@RequestBody FmsSpecificationItemConfigVo fmsSpecificationItemConfigVo) throws Exception {

		fmsSpecificationItemConfigService.updateFmsSpecificationItemConfig(fmsSpecificationItemConfigVo);
		return Ret.ok();
	}


	/**
	 * 删除 FmsSpecificationConfig
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveFmsSpecificationConfig( @RequestBody List<Long> ids ) throws Exception {

		fmsSpecificationItemConfigService.batchRemoveFmsSpecificationItemConfig(ids);
		return Ret.ok();
	}
}
